﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BackupRestore
{
    // Specifies the mode in which the program has been requested to run
    public class RunMode
    {
        // Enum to specify different debug mode

        public enum DebugMode
        {
            SEVERE = 0,  // Only log errors that require the program to exit
            ERROR = 1,   // Log only errors that you can continue running from but from where you cannot recover
            WARNING = 2, // Log recoverable errors (e.g. where a configuration is incorrect but you can use default)
            INFO = 3, // Information logging
            ENTRY = 4, // Log entry and exit for each method
            DEBUG = 5, // Log everything necessary
            NONE = 6// No Debugging
        }

     /// <summary>
     /// getter and setter for debug mode
     /// </summary>
        public DebugMode RequestedDebugMode
        {
            get;
            set;
        }
        /// <summary>
        /// ste the debug mode from the parsed string
        /// </summary>
        /// <param name="name"></param>
        public void SetDebugModeFromString(string name)
        {
            RequestedDebugMode = (DebugMode) Enum.Parse(typeof(DebugMode), name);
        }
        /// <summary>
        /// gets all possible debug modes
        /// </summary>
        /// <returns>all debug modes line ny line in a string</returns>
        public static String GetDebugModesAsNewLineSeparatedString()
        {
            return string.Join("\n", Enum.GetNames(typeof(DebugMode)));
        }
        /// <summary>
        ///checks if the string passed is a debug mode
        /// </summary>
        /// <param name="Mode">a string mode</param>
        /// <returns>true if it is, false otherwise</returns>
        public static bool IsDebugMode(string Mode)
        {
            return Enum.GetNames(typeof(DebugMode)).Contains(Mode);
        }
    }
}
